<!DOCTYPE html>
<html lang="en" class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Edit Indent</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" th:href="@{/css/font.css}">
<link rel="stylesheet" th:href="@{/css/xadmin.css}">
<script type="text/javascript" th:src="@{/lib/layui/layui.js}"
	charset="utf-8"></script>
<script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
</head>
<body>
	<div class="layui-fluid">
		<div class="layui-row">
			<form class="layui-form">
				<div class="layui-form-item" style="display: none">
					<label for="indentNo" class="layui-form-label"> <span
						class="x-red">*</span>订单编号
					</label>
					<div class="layui-input-inline">
						<input type="text" id="indentNo"
							name="indentNo" required="" lay-verify="indentNo"
							autocomplete="off" class="layui-input"
							th:value="${indent.indentNo}">
					</div>
				</div>

				<div class="layui-form-item">
					<label for="userNo" class="layui-form-label">用户编号</label>
					<div class="layui-input-inline" style="width: 66%;">
						<select  name="userMessage.userNo" id="userNo" lay-verify="">
							<option value="">[[${indent.userMessage.userNo}]]</option>
						</select>
					</div>
				</div>

				<div class="layui-form-item">
					<label for="creatTime" class="layui-form-label">订单创建时间</label>
					<div class="layui-input-inline">
						<input type="text" class="layui-input" name="creatTime" id="creatTime"
							placeholder="yyyy-MM-dd HH:mm:ss"
							th:value="${indent.creatTime}">
					</div>

				</div>
				<div class="layui-form-item">
					<label for="payTime" class="layui-form-label">付款时间</label>
					<div class="layui-input-inline">
						<input type="text" class="layui-input" name="payTime" id="payTime"
							placeholder="yyyy-MM-dd HH:mm:ss"
							th:value="${indent.payTime}">
					</div>

				</div>
				<div class="layui-form-item">
					<label for="deliveryTime" class="layui-form-label">发货时间</label>
					<div class="layui-input-inline">
						<input type="text" class="layui-input" name="deliveryTime" id="deliveryTime"
							placeholder="yyyy-MM-dd HH:mm:ss"
							th:value="${indent.deliveryTime}">
					</div>

				</div>
				<div class="layui-form-item">
					<label for="closingTime" class="layui-form-label">成交时间</label>
					<div class="layui-input-inline">
						<input type="text" class="layui-input" name="closingTime" id="closingTime"
							placeholder="yyyy-MM-dd HH:mm:ss"
							th:value="${indent.closingTime}">
					</div>

				</div>
				

				<div class="layui-form-item">
					<label for="consigneeAddress" class="layui-form-label">
						<span class="x-red">*</span>收货地址
					</label>
					<div class="layui-input-inline">
						<input type="text" id="consigneeAddress"
							name="consigneeAddress" required=""
							lay-verify="consigneeAddress" autocomplete="off"
							class="layui-input"
							th:value="${indent.consigneeAddress}">
					</div>
				</div>
				<div class="layui-form-item">
					<label for="consigneePhone" class="layui-form-label">
						<span class="x-red">*</span>收货人联系方式
					</label>
					<div class="layui-input-inline">
						<input type="text" id="consigneePhone"
							name="consigneePhone" required=""
							lay-verify="phone" autocomplete="off"
							class="layui-input"
							th:value="${indent.consigneePhone}">
					</div>
				</div>
				
				<div class="layui-form-item">
					<label for="paywayNo" class="layui-form-label">支付方式</label>
					<div class="layui-input-inline" style="width: 66%;">
						<select  name="payWay.paywayNo" id="paywayNo" lay-verify="">
							<option value="">[[${indent.payWay.paywayNo}]]</option>
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<label for="remark" class="layui-form-label">
						<span class="x-red">*</span>备注信息
					</label>
					<div class="layui-input-inline">
						<input type="text" id="remark"
							name="remark" required=""
							lay-verify="remark" autocomplete="off"
							class="layui-input"
							th:value="${indent.remark}">
					</div>
				</div>
				
				<div class="layui-form-item">
					<label for="logisticsStatusNo" class="layui-form-label">物流状态</label>
					<div class="layui-input-inline" style="width: 66%;">
						<select  name="logisticsStatus.logisticsStatusNo" id="logisticsStatusNo" lay-verify="">
							<option value="">[[${indent.logisticsStatus.logisticsStatusNo}]]</option>
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<label for="indentStatus" class="layui-form-label">
						<span class="x-red">*</span>订单状态
					</label>
					<div class="layui-input-inline">
						<input type="text" id="remark"
							name="indentStatus" required=""
							lay-verify="indentStatus" autocomplete="off"
							class="layui-input"
							th:value="${indent.indentStatus}">
					</div>
				</div>

				<div class="layui-form-item">
					<label for="L_repass" class="layui-form-label"></label>
					<button id="L_repass" class="layui-btn" lay-filter="edit"
						lay-submit="">修改</button>
				</div>
			</form>
		</div>
	</div>


	<script type="text/javascript">
		layui.use([ 'form', 'layedit', 'laydate' ,'jquery'], function() {
				$ = layui.jquery;
				var form = layui.form, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;
				laydate.render({
					elem : '#creatTime',
					type : 'datetime',
					format:'yyyy-MM-dd HH:mm:ss'

				});
				laydate.render({
					elem : '#payTime',
					type : 'datetime',
					format:'yyyy-MM-dd HH:mm:ss'

				});
				laydate.render({
					elem : '#deliveryTime',
					type : 'datetime',
					format:'yyyy-MM-dd HH:mm:ss'

				});
				laydate.render({
					elem : '#closingTime',
					type : 'datetime',
					format:'yyyy-MM-dd HH:mm:ss'

				});
				$.get("/indent/userMessageList",{},function (data) {
					var list = data;
					var select = document.getElementById('userNo');
					if (list != null || list.size() > 0) {
						for (var c in list) {
							var option = document.createElement("option");
							option.setAttribute("value", list[c].userNo);
							option.innerText = list[c].userNo;
							select.appendChild(option)
						}
					}
					form.render('select');
				},"json");
				$.get("/indent/paywayList",{},function (data) {
					var list = data;
					var select = document.getElementById('paywayNo');
					if (list != null || list.size() > 0) {
						for (var c in list) {
							var option = document.createElement("option");
							option.setAttribute("value", list[c].paywayNo);
							option.innerText = list[c].paywayNo;
							select.appendChild(option)
						}
					}
					form.render('select');
				},"json");
				$.get("/indent/logisticsStatusList",{},function (data) {
					var list = data;
					var select = document.getElementById('logisticsStatusNo');
					if (list != null || list.size() > 0) {
						for (var c in list) {
							var option = document.createElement("option");
							option.setAttribute("value", list[c].logisticsStatusNo);
							option.innerText = list[c].logisticsStatusNo;
							select.appendChild(option)
						}
					}
					form.render('select');
				},"json");
				//监听提交
				form.on('submit(edit)', function(data) {
					console.log(data.field)
					$.ajax({
						url : "/indent/edit",
						method : 'post',
						data : data.field,
						dataType : 'JSON',
						success : function(res) {
							if (res.code === 0) {
								//弹出提示，并在1秒后进行跳转
								layer.alert("修改成功", {
									icon : 6
								}, function() {
									//关闭当前frame
									xadmin.close();
									// 可以对父窗口进行刷新
									xadmin.father_reload();
									return false;
								});
							} else {
								layer.msg("修改失败:" + res.msg);
								return false;
							}
						}
					});
					return false;
				});
			})
	</script>


</body>
</html>